<!DOCTYPE html>
<html>
    <head>
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'loginHistory.label', default: 'LoginHistory')}" />
        <title>登录明细</title>
    </head>
    <body>
      <div class="small-header">
          <div class="hpanel">
              <div class="panel-body">
                  <div id="hbreadcrumb" class="pull-right">
                      <ol class="hbreadcrumb breadcrumb">
                          <li>CINDATA PLS</li>
                          <li class="active">
                              <span>登录明细</span>
                          </li>
                      </ol>
                  </div>

                  <h2 class="font-light m-b-xs">
                      登录明细
                  </h2>
              </div>
          </div>
      </div>

      <div class="content animate-panel">

          <div class="row">
              <g:form method="POST" action="searchLoginHistory" class="form-horizontal" role="form">
                  <div class="hpanel hblue">
                      <div class="panel-heading">
                          <div class="panel-tools">
                              <button class="btn btn-primary btn-xs" type="submit"><i class="fa fa-search"></i>查询</button>
                              <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                                  <i class="fa fa-times"></i>重置</button>
                          </div>
                          查询
                      </div>
                      <div class="panel-body seach-group">
                          <div class="row flex">
                              <div class="form-group col-md-4">
                                  <label  class="col-sm-3 control-label">登录名</label>
                                  <div class="col-sm-9">
                                      <input type="text" class="form-control" value="${params?.userName}" id="userName" name="userName" placeholder="请输入登录名"/>
                                  </div>
                              </div>
                              <div class="form-group col-md-4">
                                  <label for="district" class="col-sm-3 control-label">登录时间</label>
                                  <div class="col-sm-9 input-daterange input-group p-r-n"  id="datepicker" style="width: 75%;">
                                      <input type="text" class=" form-control " placeholder="请选择开始时间"
                                             value="${params?.startDateStart}" name="startDateStart" id="startDateStart" style="text-align: left" />
                                      <span class="input-group-addon">至</span>
                                      <input type="text" class=" form-control " placeholder="请选择结束时间"
                                             value="${params?.startDateEnd}" name="startDateEnd" id="startDateEnd" style="text-align: left" />
                                  </div>
                              </div>
                          </div>
                      </div>
                  </div>
              </g:form>
          </div>

          <g:if test="${flash.message}">
              <div class="alert alert-success alert-dismissible" message="alert">
                  ${flash.message}
              </div>
          </g:if>
          <div class="row">
              <div class="hpanel hgreen">
                  <div class="panel-heading">
                      <div class="panel-tools">
                      </div>
                      全部登录明细
                  </div>

                  <div class="panel-body">
                      <div class="table-responsive">
                          <table class="table table-striped table-hover">
                              <thead>
                              <tr>
                                  <g:sortableColumn property="userName" title="${message(code: 'loginHistory.userName.label', default: '登录名')}"/>
                                  <g:sortableColumn property="ip" title="${message(code: 'loginHistory.ip.label', default: 'IP')}"/>
                                  <g:sortableColumn property="status" title="${message(code: 'loginHistory.status.label', default: '状态')}"/>
                                  <g:sortableColumn property="createdDate" title="${message(code: 'loginHistory.createdDate.label', default: '登录时间')}"/>

                              </tr>
                              </thead>
                              <tbody>
                              <g:each in="${loginHistoryList}">
                                  <tr>
                                  <td>${it?.userName}</td>
                                  <td>${it?.ip}</td>
                                  <td>${it?.status}</td>
                                  <td><g:formatDate format="yyyy-MM-dd HH:mm:ss" date="${it?.createdDate}"/></td>
                                  </tr>
                              </g:each>
                              </tbody>
                          </table>
                      </div>
                  </div>

                  <div class="panel-footer">
                      <div class="pagination">
                          <g:paginate total="${loginHistoryCount ?: 0}" params="${params}"/>
                      </div>
                  </div>
              </div>
          </div>
      </div>

      <g:javascript>
          $(function () {
              $('#datepicker').datepicker({
                language: 'zh-CN'
              });
              $("#datepicker").on("changeDate", function(event) {
                  $("#my_hidden_input").val(
                          $("#datepicker").datepicker('getFormattedDate')
                  )
              });
              $('.input-group.date').datepicker({ });
              $('.input-daterange').datepicker({ });
          });

          //重置按钮
          $("#resetBtn").click(function () {
              $("#startDateEnd").val("");
              $("#startDateStart").val("");
              $("#userName").val('');
          });

      </g:javascript>

    </body>
</html>
